package com.zeta.eduservice.controller.question;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zeta.commonutils.R;
import com.zeta.eduservice.entity.question.EduQuestionTypeUser;
import com.zeta.eduservice.service.EduQuestionTypeSysService;
import com.zeta.eduservice.service.EduQuestionTypeUserAndFolderService;
import com.zeta.eduservice.service.EduQuestionTypeUserService;

/**
 * <p>
 * 题目类型 用户 前端控制器
 * </p>
 *
 * @author zeta
 * @since 2021-03-29
 */
@RestController
@RequestMapping("/eduservice/edu_question_type_user")
public class EduQuestionTypeUserController {

	@Autowired
	private EduQuestionTypeUserService serviceUser;
	@Autowired
	private EduQuestionTypeSysService serviceSys;
	@PostMapping("")
	public R save(@RequestBody EduQuestionTypeUser sys) {
		serviceUser.save(sys);
		return R.ok();                                                                                                                                                              
	}
	@GetMapping("getList/{teacherId}/{typeId}")
	public R getList(@PathVariable String teacherId,@PathVariable String typeId) {
		QueryWrapper<EduQuestionTypeUser> queryWrapper=new QueryWrapper<EduQuestionTypeUser>();
		queryWrapper.eq("teacher_id", teacherId);
		queryWrapper.eq("type_id", typeId);
		List<EduQuestionTypeUser> list = serviceUser.list(queryWrapper);
		
		return R.ok().data("list",list);
		
	}
	@DeleteMapping("{id}")
	public R delete(@PathVariable String 	id) {
		serviceUser.removeById(id);
		return R.ok();                                                                                                                                                              
	}
}
